{% set homepage_path = sylius_bundle_loaded_checker('SyliusShopBundle') ? path('sylius_shop_homepage') : '/' %}

{% if channels|length == 1 %}
    {% set channel = channels|first %}
    <a class="" href="{{ sylius_channel_url(homepage_path, channel) }}" target="_blank" rel="noopener">
        <span data-bs-toggle="tooltip" data-bs-title="{{ 'sylius.ui.view_your_store'|trans }}" data-bs-placement="right">
            {{ ux_icon('tabler:arrow-up-right') }}
        </span>
    </a>
{% elseif channels|length > 1 %}
    <div class="dropdown">
        <div type="button" data-bs-toggle="dropdown" aria-expanded="false">
            <span data-bs-toggle="tooltip" data-bs-title="{{ 'sylius.ui.view_your_store'|trans }}" data-bs-placement="right">
                {{ ux_icon('tabler:arrow-up-right') }}
            </span>
        </div>
        <ul class="dropdown-menu dropdown-menu-sm-end">
            {% for channel in channels %}
                <li><a class="dropdown-item" href="{{ sylius_channel_url(homepage_path, channel) }}" target="_blank" rel="noopener">{{ channel.name }}</a></li>
            {% endfor %}
        </ul>
    </div>
{% endif %}
